]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Restore dragged item's position on drag cancel
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 23 Jun 2020 13:33:22 +0000 (10:33 -0300)
committerFlorian Müllner <florian.muellner@gmail.com>
Mon, 20 Jul 2020 16:13:20 +0000 (16:13 +0000)
Otherwise we end up with the grid in an inconsistent state.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284

js/ui/appDisplay.js

index 5c5e70c98c95e034e45aab18ccd18f3e8bf81989..5eff0c3b96352f9931958aaf92c6ee1ef10c147d 100644 (file)
@@ -685,6 +685,7 @@ class AppDisplay extends BaseAppView {
 
         Main.overview.connect('item-drag-begin', this._onDragBegin.bind(this));
         Main.overview.connect('item-drag-end', this._onDragEnd.bind(this));
+        Main.overview.connect('item-drag-cancelled', this._onDragCancelled.bind(this));
 
         this.connect('destroy', this._onDestroy.bind(this));
 
@@ -1073,6 +1074,17 @@ class AppDisplay extends BaseAppView {
         this._resetOvershoot();
     }
 
+    _onDragCancelled(_overview, source) {
+        const view = _getViewFromIcon(source);
+
+        if (view instanceof FolderView)
+            return;
+
+        // At this point, the positions aren't stored yet, thus _redisplay()
+        // will move all items to their original positions
+        this._redisplay();
+    }
+
     _canAccept(source) {
         return source instanceof AppViewItem;
     }